<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<html>

<head>
<title>Spring MVC AMS Application</title>
<c:import url="include.jsp"></c:import>
</head>

<body>
	<div class="header" onclick="javascript:location.href='/springmvc'">
		<h1>Welcome to ASSET MANAGEMENT SYSTEM!</h1>
	</div>
	<div style="float: left; margin-left: 50px">
		<c:import url="left_menu.jsp"></c:import>
	</div>
	<div id="container">
		<h2>Manage Asset Type</h2>
		<c:choose>
			<c:when test="${isEdit == true}">
				<form:form commandName="editAssetType" id="edit" action="/springmvc/view">
					<table>
						<tbody>
							<tr>
								<td><form:hidden path="id" /></td>
							</tr>
							<tr>
								<td><form:label path="code">Asset Type Code:</form:label></td>
								<td><form:input path="code" /></td>
								<td><form:errors class="invalid" path="code" /></td>
							</tr>
							<tr>
								<td><form:label path="name">Asset Type Name:</form:label></td>
								<td><form:input path="name" /></td>
								<td><form:errors class="invalid" path="name" /></td>
							</tr>
							<tr>
								<td><form:label path="parentAssetType">Asset Type Parent:</form:label>
								<td><form:input path="parentAssetType" /></td>
								<td><form:errors class="invalid" path="parentAssetType" /></td>
							</tr>
						</tbody>
					</table>
					<table>
						<tr>
							<td><input type="submit" value="Save" class="register" /></td>
						</tr>
					</table>
				</form:form>
			</c:when>
			<c:otherwise>
				<table>
					<tbody>
						<tr>
							<td>Asset Type Code:</td>
							<td>${assetType.code}</td>
						</tr>
						<tr>
							<td>Asset Type Name:</td>
							<td>${assetType.name}</td>
						</tr>
						<tr>
							<td>Asset Type Parent:
							<td>${assetType.parentAssetType}</td>
						</tr>
					</tbody>
				</table>
				<table>
					<tr>
						<td><input type="button" value="Back" class="back"
							onclick="javascript:location.href='/springmvc/assettype'" /></td>
					</tr>
				</table>
			</c:otherwise>
		</c:choose>

	</div>

	<div id="footer">
		<p>
			Footer page.<br />
		</p>

	</div>
</body>
</html>
